<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="select01">
    <select name="" id="selectId"></select>
</div>

<script>
    var getId=[1,2,3];
    for (const number of getId) {     // number  数组value的遍历   1  2  3
        console.log(number)
        const selectId=document.getElementById('selectId')
        const option=document.createElement("option");
        option.appendChild(document.createTextNode(number));
        option.setAttribute("value",number)
        selectId.appendChild(option);
    }


  /*  for (var i in getId){

        var selectId=document.getElementById('selectId')
        var option=document.createElement("option");
        option.appendChild(document.createTextNode(getId[i]));
        option.setAttribute("value",getId[i])
        selectId.appendChild(option);

    }*/
</script>

</body>
</html>